package org.zsl.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.zsl.dao.mybatis.UserMapper;
import org.zsl.model.ResponseMsg;
import org.zsl.model.User;
import org.zsl.service.UserService3;

import java.util.List;



@RestController
@RequestMapping("/mybatis")
public class MybatisController {
      @Autowired
      private UserService3 userService3;

     @RequestMapping(value = "/list",method = RequestMethod.GET)
     public List<User> getList(){

        return    userService3.getList();
     }

     /**
      *   v --- 视图逻辑 ，重
      *   c --- 轻
      *   m --- 业务逻辑 ，重
      *   dao --- 数据库访问， crud ，轻
      * */

     @RequestMapping(value = "/register",method = RequestMethod.POST)
     public ResponseMsg register(User user){
         return  userService3.register(user);
     }
}
